package caches;

public class ImmutableWrapperCache<K, V> implements Cache<K, V> {

	private volatile Cache<K, V> cache = new UnsafeCache<>();
	@Override
	public V get(K key) {
		Cache<K, V> localCache = cache;
		return localCache.get(key);
	}

	@Override
	public void put(K key, V value) {		
		Cache<K, V> localCache = new UnsafeCache<>();
		localCache.put(key, value);
		cache = localCache;
	}
}
